import { request } from "@/utils/http"

// 添加到购物车  // 修改购物车中商品的数量
export const reqAddToCart = (skuId, skuNum) => {
  return request({
    method: "post",
    url: `/cart/addToCart/${skuId}/${skuNum}`,
  });
};

// 挂载时，获取数据
export const getShopCartApi = () => {
  return request({
    method: "get",
    url: "/cart/cartList",
  });
}

// 切换选中请求
export const getIsCheckedApi = (skuID, isChecked) => {
  return request({
    method: "get",
    url: `/cart/checkCart/${skuID}/${isChecked}`,
  });
};


// 删除商品
export const deleteGoodsApi = (skuID) => {
  return request({
    method: "delete",
    url: `/cart/deleteCart/${skuID}`,
  });

}

// 点击加加减减，更改商品数量

export const addToCart = (skuId, skuNum) => {
  return request({
    method: "post",
    url: `/cart/addToCart/${skuId}/${skuNum}`,
  });
};